(ns bowling-tests
 (:use bowling tejst.unit))

(deftest test-all-zeros
  (assert-equal
    0 
    (score [0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0])))

(deftest test-score-one
  (assert-equal 
    1 
    (score [1 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0])))

(deftest test-score-may-none-zero
  (assert-equal 
    11
    (score [3 2, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 2, 0 0, 0 4])))

(deftest test-score-a-spare-on-last-bowl-of-roll
  (assert-equal
    14
    (score [0 10, 2 0])))

(deftest test-score-a-spare-on-last-bowl-of-game
  (assert-equal
    10
    (score [0 0, 0 10])))

(deftest test-score-a-spare-scoring-on-two-balls-in-a-roll
  (assert-equal
    12
    (score [9 1, 1 0])))

(deftest test-scoring-a-single-strike
  (assert-equal 
    18
    (score [10, 2, 2])))

(deftest test-final-strike
  (assert-equal
    10
    (score [10])))

(deftest test-all-strikes
  (assert-equal
    300
    (score [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10])))

(deftest test-ten-strikes-then-two-spares
  (assert-equal
    274
    (score [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1 2])))